package day03;

import com.sun.org.apache.xerces.internal.dom.PSVIDocumentImpl;

//运算符的演示
public class OperDemo {
    public static void main(String[] args) {
        /*
        int a=5,b=6;
        int c = a++;//将a++的值5赋值给c，同时a自增1
        int d = ++b;//将++b的值6赋值给d，同时b自增1
        system.out.println(a); //6想
        system.out.println(b);//6
        system.out.println(c);//5
        system.out.println(d);//6

        int a1 = 5,b1 = 5;
        system.out.println(a++);//5
        system.out.println(a);//6
        system.out.println(++b);//6
        system.out.println(b);//6
         */
        /*
        int a=5,b=5;
        int c = a--;
        int d = --b;
        system.out.println(a); //4
        system.out.println(b);//4
        system.out.println(c);//5
        system.out.println(d);//4
         */
        /*
        int a=5,b=10,c=5;
        boolean b1 = a>b;
        System.out.println(b1);//false
        System.out.println(c<b);//true
        System.out.println(a>=c);//true
        System.out.println(a<=b);//true
        System.out.println(a==c);//true
        System.out.println(a!=c);//false

        System.out.println(a%2==0);//false
        System.out.println(a+c>b);//false
        System.out.println(a++>5);//false-------a自增1变为6
        System.out.println(a++>5);//true
    /*
    逻辑运算符：
    &&：逻辑与（并且），两边都为真则为真，见FALSE则为FALSE；
    ||:逻辑或
    ！：逻辑非
     *//*
        int a2=5,b2=10,c2=5;
        System.out.println(b>=a || b<c);  //true||false=true
        System.out.println(b<=c || b>a);  //false||true=true
        System.out.println(b!=c || b>a);  //true||true=true
        System.out.println(a==b || b<a); //false||false=false
        int score = 90;
        System.out.println(score<0 || score>100);

        short s = 5;
        //s = s+10; //编译错误，需强转，改为：s=(short)(s+10);
        s += 10;//相当于s=(short)(s+10);

        int a =5;
        a += 10; //相当于a=(int)(a+10)
        System.out.println(a); //15
        a *=2; //相当于a=(int)(a*2)
        System.out.println(a); //30
        a /=6; //相当于a=(int)(a/6)
        System.out.println(a); //5


        /*
        int age = 39;
         System.out.println("age=");
         System.out.println(age);
         System.out.println("age"+age);
         System.out.println("我今年"+age+"岁了");

         String name = "WKJ"
         System.out.println("大家好，我教"+name);
          System.out.println("大家好，我教"+name",今年"+age"岁了");
         */
        System.out.println(10+20+""+30); //3030--------String
        System.out.println("我今年"+10+20+30);//1020------String
        System.out.println(10+20+30+"");//60----------String

        //条件/三目运算符
        /*
        1)语法：
        boolean?数1：数2
        2)执行过程：
        整个表达式是有值的，它的值要么是？后的数1，要么是：数2
        计算boolean的值：
         */
        int num = 5;
        int flag = num>0?1:-1;
        System.out.println(flag);
        //找两个数中的最大值
        int a=8,b=55;
        int max = a>b?a:b;
        System.out.println(max);
        /*
        int num = 0;
        int flag = num>0?1:-1;
         System.out.println(max);
         */



    }

}
